package com.qfedu.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CrossConfig implements WebMvcConfigurer {

    //重写addCorsMappings方法解决全局跨域
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //允许前台携带cookie值，请求路径为任意
        registry.addMapping("/**").allowCredentials(true).allowedOrigins("*");
    }
}
